// Copyright (c) 2020 Presto Labs Pte. Ltd.
// Author: donggu

#pragma once
#include <string>

inline std::string replace_string(std::string str, const std::string& from, const std::string& to) {
  size_t start_pos = str.find(from);
  if (start_pos == std::string::npos) {
    return str;
  }
  str.replace(start_pos, from.length(), to);
  return str;
}

inline std::string get_pong(const std::string& str) { return replace_string(str, "ping", "pong"); }
